<!-- 需求信息 -->
<template>
	<view class="container">
		<view class="content">
			<text class="title">需求信息</text>
			<view class="list">
				<view class="list-item">
					<text class="label">需求类型：</text>
					<view class="value">{{props.detail.category_name}}</view>
				</view>
				<view class="list-item">
					<text class="label">需求名称：</text>
					<view class="value">{{props.detail.name}}</view>
				</view>
				<view class="list-item" v-if="detail.category == '1'">
					<text class="label">作业面积：</text>
					<view class="value">{{props.detail.area}}亩</view>
				</view>
				<view class="list-item" v-if="detail.category == '1'">
					<text class="label">价格预算：</text>
					<view class="value">{{parseFloat(props.detail.budget) ? props.detail.budget + '元/亩': '面议'}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	const props = defineProps({
		detail: { // 详情
			type: Object,
			default: () => ({})
		},
	});
</script>

<style lang="scss" scoped>
	.container {
		padding: 55rpx 25rpx 0;

		.content {
			.title {
				font-weight: bold;
				font-size: 30rpx;
				color: #222222;
				line-height: 1.5;
			}
		}
	}

	.list {
		background-color: white;
		border-radius: 20rpx;
		margin-top: 30rpx;
		padding-left: 30rpx;

		&-item {
			display: flex;
			align-items: center;
			height: 100rpx;
			font-size: 30rpx;
			color: #222222;
			padding-right: 30rpx;

			&+.list-item {
				border-top: 1rpx solid #E5E5E5;
			}

			&.show-right-icon {
				position: relative;

				&::after {
					position: absolute;
					right: 20rpx;
					top: 50%;
					transform: translateY(-50%);
					display: block;
					content: '\e601';
					font-family: 'iconfont';
					font-size: 20rpx;
					color: #222;
				}
			}

			.label {
				flex-shrink: 0;
			}

			.value {
				flex-grow: 1;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.unit {
				flex-shrink: 0;
			}
		}
	}
</style>